<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
</head>
<body>

<div id="app">
  <todo-item todo="hello"></todo-item>
  <todo-item2></todo-item2>
</div>

<script>

//子组件中生命props:['varName']
//父组件中通过子组件的标签属性传递varName参数

Vue.component('todo-item', {
  props: ['todo'],
  template: '<h2>{{todo}}</h2>'
})

var child = {
  template: '<h2>这是一个局部 Component</h2>'
}

new Vue({
  el: '#app',
  components:{
    'todo-item2': child
  }
})

</script>
</body>
</html>
